<script type="text/javascript">
	$("#formRoom").bind("submit", function() {
		$.ajax({
			type	: "POST",
			cache	: false,
			url		: "index.php?module=POBHotel&type=ajax&func=submit&ctrl=Room",
			data	: $(this).serializeArray(),
			success	: function(data) {
				$.facebox(data)
				$.facebox.close()
				callback_refresh()
			}
		});

		return false;
	});
	$("#formRoom").bind("reset", function() {
				$.facebox.close()
				callback_refresh()
		return false;
	});

	  function readURL1(input) {
			alert($(this));
		  if (input.files && input.files[0]) {
			  var reader = new FileReader();
			  reader.onload = function (e) {
				  $('#image1').attr('src', e.target.result).width(150);
			  }
			  reader.readAsDataURL(input.files[0]);
		  }
		  
	  }
</script>
<!--[get_all_guest_room_type]-->

<legend><!--[pnml name="_POBHOTEL_AJAX_FORM_LEGEND_ROOM"]--></legend>
  <FORM id="formRoom" name="formRoom" METHOD=POST ACTION="<!--[pnmodurl modname='POBHotel' type='ajax' func='submit' ctrl='Room']-->" enctype="multipart/form-data>">
    <input type="hidden" name="form[id]" value="<!--[$form.id]-->" />
    <TABLE width="400">
	  <tr>
        <td>
        <!--[pnml name="_POBHOTEL_AJAX_FORM_LEGEND_ROOM_TYPE"]-->
        </td>
        <td>
        <select name="form[guest_room_type_id]">
			<!--[foreach from=$guestRoomTypeArray item=itemAllGuestRoomType name=foo]-->
			  <!--[if $form.guest_room_type_id eq $itemAllGuestRoomType.guest_room_type_id]-->
				<option value="<!--[$itemAllGuestRoomType.guest_room_type_id]-->" SELECTED><!--[$itemAllGuestRoomType.guest_room_type_name]--></option>
			  <!--[else]-->
				<option value="<!--[$itemAllGuestRoomType.guest_room_type_id]-->"><!--[$itemAllGuestRoomType.guest_room_type_name]--></option>
			  <!--[/if]-->
			<!--[/foreach]-->
		</select>
        </td>
      </tr>
      <tr>
        <td>
        <!--[pnml name="_POBHOTEL_AJAX_FORM_LEGEND_ROOM_NAME"]-->
        </td>
        <td>
        <INPUT TYPE="text" NAME="form[name]" value="<!--[$form.name]-->" size="20">
        </td>
      </tr>
      <tr>
        <td>
        <!--[pnml name="_POBHOTEL_AJAX_FORM_LEGEND_ROOM_DESCRIPTION"]-->
        </td>
        <td>
        <INPUT TYPE="text" NAME="form[description]" value="<!--[$form.description]-->" size="40">
        </td>
      </tr>
	  <!--
	  <tr>
        <td>
        <!--[pnml name="_POBHOTEL_AJAX_FORM_LEGEND_ROOM_IMAGES"]-->
		<!--
        </td>
        <td>
        <INPUT TYPE="file" NAME="form[images]" onChange="readURL1(this);"><img id="image1" src="modules/POBHotel/pnimages/emptypic.png" alt="your image" />
        </td>
      </tr>
	  -->
      <tr>
        <td>
        <button id="registerButton" type="submit"><!--[pnml name="_POBHOTEL_AJAX_FORM_LEGEND_ROOM_SUBMIT"]--></button> <button id="resetButton" type="reset"><!--[pnml name="_POBHOTEL_AJAX_FORM_LEGEND_ROOM_CANCEL"]--></button>
        </td>
      </tr>
    </TABLE>
  </FORM>
